$(function () {
    //获取验证码
    $("#yzm").children(":last-child").hide();
    $("#yzm").click(function () {
        var isusername=$("#username").val().trim()
        if(isusername)
            AjaxRequest({
            url:_url+"/money/login/picturecode",
            load:true,
            data:{
                "accountnumber":$("#username").val().trim()
            },
            type:"post",
            success(res){
                if(res.code==1){
                    var ymzImg=_url+"/money/"+res.data;
                    $("#yzm").children().last().attr("src",ymzImg).show().prev().hide();
                }else{
                    $.toast("输入手机号错误","text");
                }

            }
        })
        else
            $.toast("账号不能为空","text")
    })
    //下一页
    $("#nextPage").click(
        function(){
            var nextPage=true;
            if(!$("#username").val().trim()){
                $.toast("用户名不能为空","text")
                nextPage=false;
                return;
            }
            if(!$("#inputYZM").val().trim()){
                $.toast("验证码不能为空","text");
                isregister=false;
                return ;
            }
            if(nextPage){
                sessionStorage.username=JSON.stringify($("#username").val().trim())
                AjaxRequest({
                    url:_url+"/money/login/sendcode",
                    type:"post",
                    load:true,
                    data:{
                        username:"",
                        accountnumber:$("#username").val().trim(),
                        picturecode:$("#inputYZM").val().trim(),
                        apimsg:2,
                    },
                    success(res){
                        if(isReqSucceed(res)){
                            sessionStorage.data=res.data;
                            $(window).attr("location","./messageVerification.html");
                        }
                    }
                })
                //$(window).attr("location","./messageVerification.html");
            }
        }
    );
})